package cn.u313.listener;

import cn.hutool.core.date.DateUtil;
import cn.u313.comm.conststring.Const;
import cn.u313.comm.conststring.M163Txt;
import cn.u313.comm.interfacer.SendMsg;
import cn.u313.comm.interfacer.sendLister;
import cn.u313.comm.utils.*;
import cn.u313.model.Data;
import cn.u313.model.MsgInfo;
import cn.u313.model.MusicModel;
import cn.u313.service.BlessingEntryService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.nlp.v20190408.NlpClient;
import com.tencentcloudapi.nlp.v20190408.models.ChatBotRequest;
import com.tencentcloudapi.nlp.v20190408.models.ChatBotResponse;
import com.tencentcloudapi.tbp.v20190311.models.TextProcessRequest;
import love.forte.simbot.annotation.Filter;
import love.forte.simbot.annotation.OnGroup;
import love.forte.simbot.api.message.events.GroupMsg;
import love.forte.simbot.api.message.events.PrivateMsg;
import love.forte.simbot.api.sender.MsgSender;
import love.forte.simbot.filter.MatchType;
import me.kuku.pojo.Result;
import me.kuku.test.QQlogin;
import me.kuku.test.SignIn;
import me.kuku.utils.OkHttpUtils;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okio.BufferedSink;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import static cn.u313.comm.conststring.BiaoQing.bq;
import static cn.u313.comm.conststring.Const.fish;

@Component
public class OtherListener extends BaseListen{
    List<String> grp = new ArrayList<String>(){
        List<String> a(){
            add("赚");
            add("零");
            add("花");
            add("钱");
            add("群");
            add("号");
            add("加");
            add("速");
            add("空间");
            add("吃");
            add("瓜");
            add("报");
            add("名");
            add("兼职");
            add("押金");
            add("老司机");
            add("福利");
            add("http");
            add("宝妈");
            add("学生党");
            add("涩");
            add("资料");
            add("会");
            add("结算");
            add("添加");
            add("临时工");
            add("工作");
            add("做单");
            add("不需要任何");
            add("金");
            add("招");
            add("费");
            add("逼");
            add("扩");
            add("列");
            add("dd");
            add("cp");
            return this;
        }
    }.a();
    /**
     * 复读机
     * @param groupMsg
     * @param msgSender
     */
    @OnGroup
    public void atsAPP(GroupMsg groupMsg, MsgSender msgSender) {
//        if ()

        String msg1 = groupMsg.getMsg();
        if (msg1.contains("色")||msg1.contains("涩")||msg1.contains("情"))return;
        if(msg1.length()==1){
            //可能是点歌事件
            String qqGroup = getGroup(groupMsg);
            try {
                int id=new Integer(msg1);
                if(!modelMap.containsKey(qqGroup)){
                    throw new Exception("");
                }
                List<Data> list = modelMap.get(qqGroup).getData();
                if(list.size() < id||id<0){
                    //异常的序号
                    return;
                }
                Data music = list.get(id-1);
                String key=music.getKey().split("_")[1];
                String url= JSONObject.parseObject(
                        Http.sendGet("http://plugin.313u.cn/v1/download/musics?s="+
                                URLEncoder.encode(TeaUtil.e("{\"br\":4,\"d\":\""+key+"\",\"mt\":2}"),"UTF-8"))).getString("url");
                String pic=JSONObject.parseObject(
                        Http.sendGet("http://sartist.kuwo.cn/qi.s?rid="+key+"&newver=1&encoding=utf8&isMultiArtists=0")).getString("albumPic");
                String json  ="{\"album\":\"%s\",\"id\":0," +
                        "\"img\":\"%s\"," +
                        "\"qq\":\"%s\"," +
                        "\"sid\":\"%s\"," +
                        "\"singger\":\"%s\"," +
                        "\"songid\":\"%s\"," +
                        "\"songname\":\"%s\"," +
                        "\"time\":\"%s\"," +
                        "\"url\":\"%s\"}";
                String qq =getQQ(groupMsg);
//                OkHttpUtils.post("http://121.43.181.192:9005/cgi_bin/music/save",
//                        OkHttpUtils.addJson(String.format(json,new String[]{
//                                music.getAlbum(),
//                                pic,
//                                qq,
//                                qq,
//                                music.getSingger(),
//                                music.getKey(),
//                                music.getSong(),
//                                DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"),
//                                url
//                        })),
//                        new HashMap<>());



//                String musicXml="<?xml version='1.0' encoding='UTF-8' standalone='yes' ?><msg serviceID=\"2\" " +
//                        "templateID=\"1\" action=\"web\" brief=\"&#91;分享&#93; 小嘤唱的\" sourceMsgId=\"0\" " +
//                        "url=\"https://y.qq.com/n/ryqq/songDetail/"+key+
//                        "\" " +
//                        "flag=\"0\" adverSign=\"0\" multiMsgFlag=\"0\"><item layout=\"2\"><audio cover=\""+pic+"\"" +
//                        " src=\""+url.replaceAll("&","&amp;amp;")+"\" /><title>"+music
//                        .getSong().replaceAll("&","&amp;amp;")+"</title><summary>"+music.getSingger().replaceAll("&","&amp;amp;")+"</summary></item>" +
//                        "<source name=\"QQ音乐\" icon=\"http://i.gtimg.cn/open/app_icon/01/07/98/56//1101079856_100_m.png?t=1620975393?date=20210518\" " +
//                        "url=\"http://web.p.qq.com/qqmpmobile/aio/app.html?id=1101079856\" " +
//                        "action=\"app\" a_actionData=\"com.tencent.qqmusic\" i_actionData=\"tencent1101079856://\" appid=\"1101079856\" /></msg>";
//                MsgUtil.sendMsg(msgSender,groupMsg, XmlUtil.toXml(musicXml,2));

//                CatCodeUtil catCodeUtil=CatCodeUtil.getInstance();
//                catCodeUtil.

                String title = music
                        .getSong().replaceAll("&","&amp;amp;");
                String aa = "[CAT:other,code=&#91;mirai:origin:MUSIC_SHARE&#93;][CAT:music,kind=QQ,musicUrl="+url.replaceAll("&","&amp;amp;")+",title="+title+",jumpUrl=https://i.y.qq.com/v8/playsong.html?songid&#61;&amp;source&#61;qq&amp;ADTAG&#61;pcsharetoqq,pictureUrl="+pic+
                        ",summary="+music.getSingger().replaceAll("&","&amp;amp;")+",brief=&#91;分享&#93;"+title+"]";

                System.out.println(aa);
//                String musicXml="<?xml version='1.0' encoding='UTF-8' standalone='yes' ?><msg serviceID=\"2\" " +
//                        "templateID=\"1\" action=\"web\" brief=\"&#91;分享&#93; 小嘤唱的\" sourceMsgId=\"0\" " +
//                        "url=\"https://y.qq.com/n/ryqq/songDetail/"+key+
//                        "\" " +
//                        "flag=\"0\" adverSign=\"0\" multiMsgFlag=\"0\"><item layout=\"2\"><audio cover=\""+pic+"\"" +
//                        " src=\""+url.replaceAll("&","&amp;amp;")+"\" /><title>"+music
//                        .getSong().replaceAll("&","&amp;amp;")+"</title><summary>"+music.getSingger().replaceAll("&","&amp;amp;")+"</summary></item>" +
//                        "<source name=\"QQ音乐\" icon=\"http://i.gtimg.cn/open/app_icon/01/07/98/56//1101079856_100_m.png?t=1620975393?date=20210518\" " +
//                        "url=\"http://web.p.qq.com/qqmpmobile/aio/app.html?id=1101079856\" " +
//                        "action=\"app\" a_actionData=\"com.tencent.qqmusic\" i_actionData=\"tencent1101079856://\" appid=\"1101079856\" /></msg>";
//                MsgUtil.sendMsg(msgSender,groupMsg, XmlUtil.toXml(musicXml,2));
                msgSender.SENDER.sendGroupMsg(groupMsg,aa);
//                CatCodeUtil catCodeUtil=CatCodeUtil.getInstance();
//                catCodeUtil.


                return ;
            } catch (Exception e) {
                e.printStackTrace();
            }

        }



        if(msg1.contains("摸鱼")){
            return;
        }
        System.err.println(msg1);

        //guanggao
        String g= "";
        int i =0;
        String msg= msg1;

        if (msg.contains("com.tencent.mannounce"))return;
        if(msg.contains("吃瓜群众")||msg.contains("[CAT:rich,content=")){
         return;
        }
        if (msg.contains("CAT:text"))return;
        for (String s : grp) {
            if (msg.contains(s)){
                i++;
                g+=s+",";
            }
        }
        if (i>2){
            MsgUtil.sendMsg(msgSender,groupMsg,"广告狗？");
            MsgUtil.sendMsg(msgSender,groupMsg,"触发关键字 [ "+g+" ]\n上面疑似广告内容，大家可千万别信哦！");

            msgSender.SETTER.setGroupBan(getGroup(groupMsg), getQQ(groupMsg), 60*10);
            msgSender.SETTER.setMsgRecall(groupMsg.getFlag());
            return;
        }


        if(MsgUtil.isFuMsg(groupMsg))
        {
            if(msg1.contains("钱")|| msg1.contains("加")){
                MsgUtil.sendMsg(msgSender,groupMsg,"广告狗？");
                return;
          }
            MsgUtil.sendMsg(msgSender,groupMsg, msg1);
            preStr= msg1;
        }
        else
            MsgUtil.addMsg(groupMsg);
    }
    GroupMsg groupMsg = null;
    @OnGroup
    @Filter(value = "点歌",matchType = MatchType.CONTAINS)
    public  void diange(GroupMsg groupMsg, MsgSender sender)
    {
        if (true){
            sendMsg(sender,groupMsg,"年久失修！");
            return;
        }
        String qqGroup = getGroup(groupMsg);
        if (groupMsg.getMsg().length()<=2){
            sendMsg(sender,groupMsg,"请说明你要点的歌名+歌手，\n如：点歌周杰伦 晴天");
            return;
        }
        String urls="http://plugin.313u.cn/v1/music/search/kuWoMusicx?bid=135465&n=6&p=1&type=2&name="
                +e(groupMsg.getMsg().substring(2) );

//            String searchResult =  Http.sendGet("http://121.196.47.176:8096/v1/download/musics?s="+
//                    URLEncoder.encode(TeaUtil.e("{\"br\":4,\"d\":\""+msg.getMsg().substring(2).split("_")[1]+"\",\"mt\":2}"),"UTF-8"));
        String searchResult =  Http.sendGet(urls);
        MusicModel musicModel= JSONObject.toJavaObject(JSONObject.parseObject(searchResult), MusicModel.class);
        MsgUtil.sendMsg(sender,groupMsg,musicModel.toString());
        if(modelMap.containsKey(qqGroup)){
            modelMap.replace(qqGroup,musicModel);
        }else{
            modelMap.put(qqGroup,musicModel);
        }
    }
    /**
     *
     */

    String[] biaodianfu = {" ? ", " ! ", " , ", " ?? ", " ??? ", " ！！ ", " 。 ", " ","\n"};
    @OnGroup
    @Filter(value = "嘤嘤",matchType = MatchType.STARTS_WITH)
    public void yyy(GroupMsg groupMsg, MsgSender msgSender) {

        String y = "";
        int n = (int) (Math.random() * 7) + 2;
        int mod = (int) (Math.random() * 20);
        for (int i = 0; i < n; i++) {
            y += "嘤";
        }
        if (y.length() > 0)
            y += biaodianfu[(int) (Math.random() * biaodianfu.length)];
        String x = "";
        String z = "";
        if (mod > 3) {
            int n0 = (int) (Math.random() * 7);
            for (int i = 0; i < n0; i++) {
                x += "嘤";
            }
            if (x.length() > 0)
                x += biaodianfu[(int) (Math.random() * biaodianfu.length)];
        }
        if (mod > 7) {
            int n0 = (int) (Math.random() * 7);
            for (int i = 0; i < n0; i++) {
                z += "嘤";
            }
            if (z.length() > 0)
                z += biaodianfu[(int) (Math.random() * biaodianfu.length)];
        }


        MsgUtil.sendMsg(msgSender,groupMsg,(y + x + z));
    }
    String[] lsy={
            "柳苏言是灵悦\n雇来的廉价劳动力哦",
            "柳苏言是谁呀\n听说ta在考嘤语四级呢",
            "不许直呼小嘤的佣人！",
            "柳苏言不是这么用哒",
            "诶？叫我干啥嘞"
    };

    @OnGroup
    @Filter(value = "柳苏言",matchType =  MatchType.EQUALS)
    public void getSay0(GroupMsg groupMsg, MsgSender msgSender) {
        MsgUtil.sendMsg(msgSender,groupMsg, lsy[(int)(Math.random()*(lsy.length-1))]);
    }
    @OnGroup
    @Filter(value = "#",matchType =  MatchType.STARTS_WITH)
    public void getSay(GroupMsg groupMsg, MsgSender msgSender) {
        String msg = groupMsg.getMsg();
        if (msg.length() == 1) {
            MsgUtil.sendMsg(msgSender,groupMsg, "嘤嘤嘤，[CAT:face,id=178]你要干嘛");
            return;
        }
        msg = msg.substring(1);

        if(msg.contains("柳苏言")){
            MsgUtil.sendMsg(msgSender,groupMsg, lsy[(int)(Math.random()*(lsy.length-1))]);
            return;
        }
        try {

            Credential cred = new Credential("AKIDQqRzLjSrHQKyRdEVlrncFm8WnY5TCXHl", "NYVCeqmEmKivtaBpDLVP8amhYBbrz4wg");

            HttpProfile httpProfile = new HttpProfile();
            httpProfile.setEndpoint("nlp.tencentcloudapi.com");

            ClientProfile clientProfile = new ClientProfile();
            clientProfile.setHttpProfile(httpProfile);

            NlpClient client = new NlpClient(cred, "ap-guangzhou", clientProfile);

            ChatBotRequest req = new ChatBotRequest();
            req.setQuery(msg);

            ChatBotResponse resp = client.ChatBot(req);

//            System.out.println(ChatBotResponse.toJsonString(resp));
            MsgUtil.sendMsg(msgSender,groupMsg, JSON.parseObject(TextProcessRequest.toJsonString(resp))
                    .getString("Reply")
                    .replaceAll("腾讯", "")
                    .replaceAll("小龙女", "可爱的小嘤")
            );
        } catch (TencentCloudSDKException e) {
            System.out.println(e.toString());
        }

    }
    String[] hbstr={
            "你是不是在拿小嘤寻开心啊！",
            "你莫不是在拿洒家寻开心啊！"
    };
    @OnGroup
    @Filter(value = "[QQ红包]请使用新版手机QQ查收红包。",matchType = MatchType.STARTS_WITH)
    public void test001(GroupMsg groupMsg, MsgSender msgSender) {
        if(groupMsg.getMsg().contains("[CAT:unsupported,struct="))
            sendMsg(msgSender,groupMsg,"嘿嘿，感谢铁汁发的大红包！");
        else
            sendMsg(msgSender,groupMsg,hbstr[(int)(hbstr.length*Math.random())],false);

    }@OnGroup
    @Filter(value = "菜单",matchType = MatchType.STARTS_WITH)
    @Filter(value = "功能",matchType = MatchType.STARTS_WITH)
    public void meun(GroupMsg groupMsg, MsgSender msgSender) {

            sendMsg(msgSender,groupMsg,
                    "☆☆☆☆☆☆☆☆☆☆☆☆\n" +
                    "☆菜单\n" +
                    "☆☆☆☆☆☆☆☆☆☆☆☆\n" +
                    "☆签到\n" +
                    "☆打劫\n" +
                    "☆抽红包\n" +
                    "☆嘤鱼系统\n" +
                    "☆网抑云\n" +
                    "☆摸鱼\n" +
                    "☆点歌\n" +
                    "☆抽红包\n" +
                    "☆兑换\n" +
                    "☆红包十连（测试）\n" +
                    "☆悦币十连（测试）\n" +
                    "☆舔狗日记\n" +
                    "☆大鱼吃小鱼\n" +
                    "☆☆☆☆☆☆☆☆☆☆☆☆\n" +
                    "还有更多功能自己发掘哦！\n" +
                    "\n",false);

    }
    @OnGroup
    @Filter(value = "自闭",matchType = MatchType.STARTS_WITH)
    @Filter(value = "闭关",matchType = MatchType.STARTS_WITH)
    public void 自闭(GroupMsg groupMsg, MsgSender msgSender) {
        try {

            String QQ = getQQ(groupMsg);
//            boolean f = msgSender.GETTER.getGroupMemberList(groupMsg). .getGroupMemberInfo(groupMsg.getGroup(), QQ, true).getPowerType().TYPE == -1;
//            if (!f) {
//                sendMsg(msgSender,groupMsg, "哎呀，给不了你想要的自闭呢！" );
//                return;
//            }
            if (Math.random() * 100 % 10 < 5) {
                int n = (int) (Math.random() * 20) * 60 + 300;
                msgSender.SETTER.setGroupBan(getGroup(groupMsg), QQ, n);
                MsgUtil.sendMsg(msgSender,groupMsg, "恭喜你获得修炼BUFF\n送入小黑屋修炼" + n + "秒" );
//		        		msgSender.SETTER.setGroupBan(groupMsg.getGroup(),QQ,521);
//	        			MsgUtil.sendMsg(msgSender,groupMsg, "[CQ:at,qq="+QQ+"] 触发 521 特殊 BUFF  送入小黑屋521秒\n"+s);
            } else {
                int aa= (int)(5*Math.random())+1;
                msgSender.SETTER.setGroupBan(getGroup(groupMsg), QQ,aa );
                MsgUtil.sendMsg(msgSender,groupMsg, "已将你送入小黑屋"+aa+"秒\n嘿嘿ieeee" );
            }
            // msgSender.SETTER.setGroupBan(groupMsg.getGroup(),QQ,60*5);

        } catch (Exception e) {
            e.printStackTrace();
            MsgUtil.sendMsg(msgSender,groupMsg, "哎呀呀\n小嘤没权限给你想要的东西呢！");
        }

    }
    @OnGroup
    @Filter(value = "放鱼",matchType = MatchType.CONTAINS)
    public void fayu(GroupMsg groupMsg, MsgSender msgSender) {
        if (isManager(getQQ(groupMsg))) {
            if (fish > 0) {
                sendMsg(msgSender,groupMsg, "还有" + fish + "条鱼呢");
                return;
            }

            fish = new Integer(getN(groupMsg));
            MsgUtil.sendMsg(msgSender,groupMsg,"1138032950", "这么冷当然要摸鱼啦，快发送【摸鱼】参与进我们摸鱼大军吧，有悦币哦");
            MsgUtil.sendMsg(msgSender,groupMsg,"429402891",  "这么冷当然要摸鱼啦，快发送【摸鱼】参与进我们摸鱼大军吧，有悦币哦");
            MsgUtil.sendMsg(msgSender,groupMsg,"217464439",  "这么冷当然要摸鱼啦，快发送【摸鱼】参与进我们摸鱼大军吧，有悦币哦");
            MsgUtil.sendMsg(msgSender,groupMsg,"1127256559", "这么冷当然要摸鱼啦，快发送【摸鱼】参与进我们摸鱼大军吧，有悦币哦");
            MsgUtil.sendMsg(msgSender,groupMsg,"733860730",  "这么冷当然要摸鱼啦，快发送【摸鱼】参与进我们摸鱼大军吧，有悦币哦");
            MsgUtil.sendMsg(msgSender,groupMsg, "已放=" + fish + "条鱼");
            Const.yu = new HashMap<>();

            Util.TimerMoyu = System.currentTimeMillis();
        }
        ;
        // msgSender.SENDER.sendPrivateMsg(groupMsg, "测试[mirai:image:{A2B367AE-E439-1625-E645-C61562EC5184}.mirai]");
    }

    /**
     * 配置
     * @param groupMsg
     * @param msgSender
     */
    @OnGroup
    @Filter(value = "AD",matchType = MatchType.STARTS_WITH)
    public void AD(GroupMsg groupMsg, MsgSender msgSender) {
        if (isManager(getQQ(groupMsg))) {
            String a = groupMsg.getMsg().substring(2);
            MsgUtil.ADMSG = "\n✨✨✨✨✨✨✨✨\n"+a ;
            sendMsg(msgSender,groupMsg,"修改成功");
        }
        ;
        // msgSender.SENDER.sendPrivateMsg(groupMsg, "测试[mirai:image:{A2B367AE-E439-1625-E645-C61562EC5184}.mirai]");
    }
    @OnGroup
    @Filter(value = "aigpt",matchType = MatchType.STARTS_WITH)
    public void aigpt(GroupMsg groupMsg, MsgSender msgSender) {
        if (isManager(getQQ(groupMsg))) {
            String a = groupMsg.getMsg().substring(5);
            MsgUtil.maxToken = new Integer(a);
            sendMsg(msgSender,groupMsg,"修改成功");
        }
        ;
        // msgSender.SENDER.sendPrivateMsg(groupMsg, "测试[mirai:image:{A2B367AE-E439-1625-E645-C61562EC5184}.mirai]");
    }
    /**
     * 网抑云
     * @param groupMsg
     * @param msgSender
     */
    @OnGroup
    @Filter(value = "网易",matchType = MatchType.CONTAINS)
    @Filter(value = "网抑",matchType = MatchType.CONTAINS)
    @Filter(value = "到点了",matchType = MatchType.CONTAINS)
    @Filter(value = "生而为人",matchType = MatchType.CONTAINS)
    @Filter(value = "我很抱歉",matchType = MatchType.CONTAINS)
    public void m163(GroupMsg groupMsg, MsgSender msgSender) {
            sendMsg(msgSender,groupMsg, TxtUtil.radomTxt(M163Txt.wangYI));
    }
    @OnGroup
    @Filter(value = "表情包",matchType = MatchType.CONTAINS)
    public void bqb(GroupMsg groupMsg, MsgSender msgSender) {
        sendMsg(msgSender,groupMsg, getImgCAT(TxtUtil.radomTxt(bq),false));
    }
//    @OnGroup
//    @Filter(value = "登陆",matchType = MatchType.CONTAINS)
//    @Filter(value = "登录",matchType = MatchType.CONTAINS)
//    public void 登陆(GroupMsg groupMsg, MsgSender msgSender) {
//        if(isManager(getQQ(groupMsg)))
//        try {
//            new Thread(() -> {
//                Result<String> msg = null;
//                System.out.println("login>>>1");
//                try {
//                    msg = QQlogin.login(new MsgInfo(groupMsg,msgSender));
//                } catch (IOException e) {
//                    e.printStackTrace();
//                }
//
//            }).start();
//
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }

    @OnGroup
    @Filter(value = "福卡处理",matchType = MatchType.CONTAINS)
    public void fuka (GroupMsg groupMsg, MsgSender msgSender) {


    }
    @OnGroup
    @Filter(value = "打卡2019",matchType = MatchType.CONTAINS)
    public void daka (GroupMsg groupMsg, MsgSender msgSender) {
        String id=groupMsg.getMsg();
        id = id.substring(2);
        id = id.replace(" ","");
        id = id.replace("打卡","");
        if(isManager(getQQ(groupMsg)))
            try {
                String finalId = id;
                new Thread(() -> {
                    try {
                        SignIn.qiandao(finalId,new MsgInfo(groupMsg,msgSender));
                    } catch (Exception e) {
                        e.printStackTrace();
                    }

                }).start();

            } catch (Exception e) {
                e.printStackTrace();
            }
    }
    String[] strings={
            "什么事呀?",
            "你戳疼人家了",
            "干嘛呀",
            "怎么了呀",
            "在呢在呢",
            "在哦",
            "略略略",
            "干嘛",
            "小花花送你",
            "给爷爬",
            "哼",
            "?",
            "哼哼",
            "不要戳我",
            null
    };
    //[CAT:poke,type=0,id=0]
    long aLong = 0;
    @OnGroup
//    @Filter(value = ".*nudge.*",matchType = MatchType.REGEX_MATCHES)
    public void test002(GroupMsg groupMsg, MsgSender msgSender) {
        if (aLong+2000>System.currentTimeMillis())return;
        //被戳的
        if(groupMsg.getMsg().contains("CAT:nudge,from"))
        {
            String qq0 = getCAT(groupMsg,"target");
            String from = getCAT(groupMsg,"from");

            if(qq0.equals("2036085374")){
                aLong = System.currentTimeMillis();
                String r = TxtUtil.radomTxt(strings);
                if (r == null) {
                    sendMsg(msgSender,groupMsg,"[CAT:nudge,from=2036085374,target="+from+"]",false);
                }else
                    sendMsg(msgSender,groupMsg,r,false);
            }
        }

    }
    String xmlString = "[CAT:rich,content=<?xml version&#61;'1.0' encoding&#61;'UTF-8' standalone&#61;'yes' ?><msg serviceID&#61;\"108\" templateID&#61;\"1\" action&#61;\"web\" brief&#61;\"&#91;分享&#93; 兄弟！帮帮忙，点一点\" sourcePublicUin&#61;\"2747277822\" sourceMsgId&#61;\"0\" url&#61;\"https://youxi.gamecenter.qq.com/m/act/a6ba857ba061ef0b_10071831.html?_wv&#61;1&amp;amp;_wwv&#61;4&amp;amp;invite_uin&#61;5ZcYGVbPPiOfIPHkutyPRA%3D%3D&amp;amp;adtag&#61;hd10071845\" flag&#61;\"0\" adverSign&#61;\"0\" multiMsgFlag&#61;\"0\"><item layout&#61;\"2\" advertiser_id&#61;\"0\" aid&#61;\"0\"><picture cover&#61;\"https://qgsk.yximg.cn/box/10071845/1653408429_28.jpg\" w&#61;\"0\" h&#61;\"0\" /><title>兄弟！帮帮忙，点一点</title><summary>这7Q币我今天一定要领到。</summary></item><source name&#61;\"QQ手游\" icon&#61;\"https://url.cn/JS8oE7\" action&#61;\"plugin\" a_actionData&#61;\"mqqapi://app/action?pkg&#61;com.tencent.mobileqq&amp;amp;cmp&#61;com.tencent.biz.pubaccount.AccountDetail.activity.api.impl.AccountDetailActivity&amp;amp;uin&#61;2747277822\" i_actionData&#61;\"mqqapi://card/show_pslcard?src_type&#61;internal&amp;amp;card_type&#61;public_account&amp;amp;uin&#61;2747277822&amp;amp;version&#61;1\" appid&#61;\"-1\" /></msg>,serviceId=108]";
    String xmlString0 = "[CAT:rich,content=<?xml version&#61;'1.0' encoding&#61;'UTF-8' standalone&#61;'yes' ?><msg serviceID&#61;\"108\" templateID&#61;\"1\" action&#61;\"web\" brief&#61;\"你的小嘤被人拐跑啦！\" sourcePublicUin&#61;\"2747277822\" sourceMsgId&#61;\"0\" url&#61;\"https://youxi.gamecenter.qq.com/m/act/\" flag&#61;\"0\" adverSign&#61;\"0\" multiMsgFlag&#61;\"0\"><item layout&#61;\"2\" advertiser_id&#61;\"0\" aid&#61;\"0\"><picture cover&#61;\"http://gchat.qpic.cn/gchatpic_new/1054980699/1138032950-3064777936-339496199390FD081C60ACE5A05C231C/0?term&#61;3\" w&#61;\"0\" h&#61;\"0\" /><title>签到成功</title><summary>获得 10 悦币</summary></item></msg>,serviceId=108]";
    @OnGroup
    @Filter(value = "test025",matchType = MatchType.CONTAINS)
    public void test025 (GroupMsg groupMsg, MsgSender msgSender) {
        sendMsg(msgSender,groupMsg,xmlString);
    }    @OnGroup
    @Filter(value = "test026",matchType = MatchType.CONTAINS)
    public void asf (GroupMsg groupMsg, MsgSender msgSender) {
        sendMsg(msgSender,groupMsg,xmlString0);
    }
    @Filter(value = "发送",matchType = MatchType.STARTS_WITH)
    public void 发送 (GroupMsg groupMsg, MsgSender msgSender) {
        if (isManager(groupMsg)){

            sendMsg(msgSender,groupMsg,groupMsg.getMsg().substring(2));
        }
    }
    @OnGroup
    @Filter(value = "贴贴",matchType = MatchType.CONTAINS)
    public void tt (GroupMsg groupMsg, MsgSender msgSender) {
        sendMsg(msgSender,groupMsg,"才不要和你贴贴呢");
    }
    @OnGroup
    @Filter(value = "服务器",matchType = MatchType.CONTAINS)
    public void fwqq (GroupMsg groupMsg, MsgSender msgSender) {
        String url = "http://plugin.313u.cn/";
        try {
            int i = OkHttpUtils.get(url).code();
            System.out.println("APP服务器状态："+i);
            if (i>500){

                sendMsg(msgSender,groupMsg,"app服务器状态[ "+i+" ]\n出现这个说明服务器炸了\n建议联系群主修复");
                return;
            }
            sendMsg(msgSender,groupMsg,"app服务器正常");
        } catch (IOException e) {

            sendMsg(msgSender,groupMsg,"app服务器状态[ 500 ]\n出现这个说明服务器炸了\n建议联系群主修复");
            e.printStackTrace();
        }
    }
}
